import { reqBankCardInfo, reqPayPassword, addBankCard, delBankCard } from '@/api'

export default {
    actions: {
        async getBankCardInfo({ commit }, data) {
            let res = await reqBankCardInfo(data)
            // console.log(res)
            if (res.code == 200) {
                commit('GETBANKCARDINFO', res.data)
            }
        },
        async getPayPassword({ commit }, data) {
            let res = await reqPayPassword(data)
            if (res.code == 200) {
                commit('GETPAYPASSWORD', res.data[0].pay_password)
            }
        },
        async addBankCard({ commit }, data) {
            let res = await addBankCard(data)
            // console.log(res)
            if (res.code == 200) {
            }
        },
        async delBankCard({ commit }, data) {
            let res = await delBankCard(data)
            // console.log(res)
            if (res.code == 200) {
            }
        },
    },
    mutations: {
        GETBANKCARDINFO(state, data) {
            state.bankCard = data
        },
        GETPAYPASSWORD(state, data) {
            state.payPassword = data
        },
    },
    state: {
        bankCard: [],
        payPassword: '',
    },
    getters: {
    },
    modules: {
    }
}